package com.example.exceldemo.entity;

import cn.afterturn.easypoi.excel.annotation.Excel;
import cn.afterturn.easypoi.excel.annotation.ExcelCollection;
import cn.afterturn.easypoi.excel.annotation.ExcelTarget;
import lombok.Data;

import java.util.Date;
import java.util.List;


//导出含list集合数据,一对多关系，需要合并单元格 needMerge = true
@Data
@ExcelTarget("userEntity")
public class UserEntityList {
    @Excel(name = "姓名",orderNum = "1",width = 20,needMerge = true )
    private String name;
    @Excel(name = "年龄",orderNum = "2",width = 20,needMerge = true,type = 10)
    private  Integer age;
    //replace 值得替换 导出是{a_id,b_id} 导入反过来
    @Excel(name = "性别",orderNum = "3",width = 20,replace = {"男_1","女_2"},needMerge = true)
    private String sex;
    @Excel(name = "生日",orderNum = "4",width = 20,format = "yyyy-MM-dd",needMerge = true)
    private Date birthday;
    //导出含list集合数据,一对多关系，需要合并单元格 needMerge = true
    @ExcelCollection(name = "商品列表",orderNum = "10")
    private List<Product> products;
}